from selenium import webdriver
from selenium.webdriver.common.by import By

from webauto.test_webauto_practice.test_enterprise_wechat.po_address_book.package.address_book_package import \
    AddressBookPackage
from webauto.test_webauto_practice.test_enterprise_wechat.po_address_book.package.min_main_package import MinMainPackage


class MainPackage:
    def __init__(self):
        chrome_arg = webdriver.ChromeOptions()
        chrome_arg.debugger_address = "127.0.0.1:1234"
        self.driver = webdriver.Chrome(options=chrome_arg)
        # self.driver.implicitly_wait(10)

    def get_min_main(self):
        self.driver.find_element(By.XPATH, "//*[@id='menu_contacts']").click()
        return MinMainPackage(self.driver)

    def get_address_book(self):
        self.driver.find_element(By.XPATH, "//*[@id='menu_contacts']").click()
        return AddressBookPackage(self.driver)
        # return AddressBookPackage(self.driver).add_user() 具体方法在编写测试脚本中调用，这里只定位到类即可，故不写此方法
